(function ($) {
	var videoObj;
	var oldTime = 10
	$.init();
	$.plusReady(function() {
		baseSetup();
	});
	function baseSetup(){
		videoObj = new plus.video.VideoPlayer('video',{
			src:'2017123101.mp4',
			'enable-progress-gesture':false,
			'poster':'https://alifei05.cfp.cn/creative/vcg/800/new/VCG41N1210205351.jpg',
			'initial-time':oldTime
		});
		videoObj.addEventListener('play', function(){
			updatePlaying(true);
		}, false);
		videoObj.addEventListener('pause', function(){
			updatePlaying(false);
		}, false);
		
		
		videoObj.addEventListener('timeupdate', function(event){
			var currentTime = event.detail.currentTime
			if ((currentTime - oldTime)*1000 > 300) {
				videoObj.pause()
				var timeInt = parseInt(oldTime)
				videoObj.seek(timeInt)
				oldTime = timeInt
				setTimeout(function(){
					videoObj.play()
				},100)
				return
			}
			oldTime=currentTime
		}, false);
	}
	function updatePlaying(flag){
		//console.log(flag)
	}
})(mui)